package com.ylr.basic.framework.feign.client;

import com.ylr.basic.common.dto.EphemeralDataDto;
import com.ylr.base.common.tool.Result;
import com.ylr.basic.common.vo.ephemeral_data.EphemeralDataQueryVo;
import com.ylr.basic.common.vo.ephemeral_data.EphemeralDataVo;
import com.ylr.basic.framework.feign.YbEphemeralDataBaseClient;
import com.ylr.basic.framework.feign.configuration.ClientConfiguration;
import com.ylr.basic.framework.feign.fallback.YbEphemeralDataClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2023-07-07 15:07:37
 * className: YbEphemeralDataClient
 * version: 1.0
 * description:
 */
@FeignClient(value = "ylr-basic", contextId = "YbEphemeralDataClient", path = "/api/ephemeral-data",
        fallback = YbEphemeralDataClientFallback.class, configuration = ClientConfiguration.class)
public interface YbEphemeralDataClient extends YbEphemeralDataBaseClient {

    /**
     * 保存临时数据接口
     * @param ephemeralDataVo 参数对象
     * @return 结果
     */
    @PostMapping("/save")
    Result<Object> saveEphemeralData(@Validated @RequestBody EphemeralDataVo ephemeralDataVo);

    /**
     * 获取临时数据接口
     * @param businessId   业务主键
     * @param businessType 业务类型
     * @return 结果
     */
    @GetMapping("/get")
    Result<EphemeralDataDto> getEphemeralData(@RequestParam("businessId") Long businessId,
                                              @RequestParam("businessType") Integer businessType);

    /**
     * 批量获取临时数据接口
     * @param ephemeralDataQueryVo 参数对象
     * @return 结果
     */
    @PostMapping("/batch/get")
    Result<List<EphemeralDataDto>> batchGetEphemeralData(EphemeralDataQueryVo ephemeralDataQueryVo);

    /**
     * 删除临时数据接口
     * @param businessId   业务主键
     * @param businessType 业务类型
     * @return 结果
     */
    @DeleteMapping("/delete/v2")
    Result<Object> deleteEphemeralData(@RequestParam("businessId") Long businessId,
                                       @RequestParam("businessType") Integer businessType);
}
